Skip to content

Design doc: add Declarative API section #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 1, 2024

Conversation

BoD
Copy link
Collaborator

@BoD BoD commented Aug 1, 2024

No description provided.

@BoD BoD requested a review from martinbonnin as a code owner August 1, 2024 13:53

### Schema directives

These directives will land in a `cache` v0.1 [Apollo Spec](https://specs.apollo.dev/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much could we reuse the server side@cacheControl?

https://www.apollographql.com/docs/apollo-server/performance/caching/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout! We could probably reuse it with a few remarks:

  • scope is irrelevant on the client (can simply be ignored)
  • the meaning of applying the directive to a type is different to what I imagined here, but I think it may be equivalent
    • this draft: value for the type's fields
    • Apollo Server's version: value for all fields that are of the type
  • trying to wrap my head around inheritMaxAge - not sure why it's useful
  • we still need a "Field" version of the directive

Copy link
Contributor

@martinbonnin martinbonnin Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope is irrelevant on the client (can simply be ignored)

We could have cross-user cache. For an example, in Confetti, all the session data is PUBLIC, but the bookmarks are PRIVATE. We're not there yet but could be something?

Agree ignoring it for now is fine.

we still need a "Field" version of the directive

Yea, either @cacheControlField() or field definition extensions in the GraphQL 2.0 spec 🤓

Overall, agree that we could model things more precisely but the prospect of getting all of these for free from the backend is pretty enticing

@BoD BoD merged commit c0b5fb3 into main Oct 1, 2024
2 checks passed
@BoD BoD deleted the design-doc-expiration-declarative branch October 1, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants